.class Lcom/philzhu/www/framework/TestScreen;
.super Lcom/philzhu/www/framework/Screen;
.source "TestScreen.java"


# instance fields
.field bob:Lcom/philzhu/www/framework/Pixmap;

.field bobAlpha:Lcom/philzhu/www/framework/Pixmap;

.field frames:I

.field music:Lcom/philzhu/www/framework/Music;

.field sound:Lcom/philzhu/www/framework/Sound;

.field startTime:J


# direct methods
.method public constructor <init>(Lcom/philzhu/www/framework/Game;)V
    .locals 8
    .parameter "game"

    .prologue
    .line 25
    invoke-direct {p0, p1}, Lcom/philzhu/www/framework/Screen;-><init>(Lcom/philzhu/www/framework/Game;)V

    .line 17
    invoke-static {}, Ljava/lang/System;->nanoTime()J

    move-result-wide v5

    iput-wide v5, p0, Lcom/philzhu/www/framework/TestScreen;->startTime:J

    .line 26
    invoke-interface {p1}, Lcom/philzhu/www/framework/Game;->getGraphics()Lcom/philzhu/www/framework/Graphics;

    move-result-object v5

    const-string v6, "bobrgb888.png"

    sget-object v7, Lcom/philzhu/www/framework/Graphics$PixmapFormat;->RGB565:Lcom/philzhu/www/framework/Graphics$PixmapFormat;

    invoke-interface {v5, v6, v7}, Lcom/philzhu/www/framework/Graphics;->newPixmap(Ljava/lang/String;Lcom/philzhu/www/framework/Graphics$PixmapFormat;)Lcom/philzhu/www/framework/Pixmap;

    move-result-object v5

    iput-object v5, p0, Lcom/philzhu/www/framework/TestScreen;->bob:Lcom/philzhu/www/framework/Pixmap;

    .line 27
    invoke-interface {p1}, Lcom/philzhu/www/framework/Game;->getGraphics()Lcom/philzhu/www/framework/Graphics;

    move-result-object v5

    const-string v6, "bobargb8888.png"

    sget-object v7, Lcom/philzhu/www/framework/Graphics$PixmapFormat;->ARGB4444:Lcom/philzhu/www/framework/Graphics$PixmapFormat;

    invoke-interface {v5, v6, v7}, Lcom/philzhu/www/framework/Graphics;->newPixmap(Ljava/lang/String;Lcom/philzhu/www/framework/Graphics$PixmapFormat;)Lcom/philzhu/www/framework/Pixmap;

    move-result-object v5

    iput-object v5, p0, Lcom/philzhu/www/framework/TestScreen;->bobAlpha:Lcom/philzhu/www/framework/Pixmap;

    .line 28
    invoke-interface {p1}, Lcom/philzhu/www/framework/Game;->getAudio()Lcom/philzhu/www/framework/Audio;

    move-result-object v5

    const-string v6, "music.ogg"

    invoke-interface {v5, v6}, Lcom/philzhu/www/framework/Audio;->newMusic(Ljava/lang/String;)Lcom/philzhu/www/framework/Music;

    move-result-object v5

    iput-object v5, p0, Lcom/philzhu/www/framework/TestScreen;->music:Lcom/philzhu/www/framework/Music;

    .line 29
    iget-object v5, p0, Lcom/philzhu/www/framework/TestScreen;->music:Lcom/philzhu/www/framework/Music;

    const/4 v6, 0x1

    invoke-interface {v5, v6}, Lcom/philzhu/www/framework/Music;->setLooping(Z)V

    .line 30
    iget-object v5, p0, Lcom/philzhu/www/framework/TestScreen;->music:Lcom/philzhu/www/framework/Music;

    const/high16 v6, 0x3f00

    invoke-interface {v5, v6}, Lcom/philzhu/www/framework/Music;->setVolume(F)V

    .line 31
    iget-object v5, p0, Lcom/philzhu/www/framework/TestScreen;->music:Lcom/philzhu/www/framework/Music;

    invoke-interface {v5}, Lcom/philzhu/www/framework/Music;->play()V

    .line 32
    invoke-interface {p1}, Lcom/philzhu/www/framework/Game;->getAudio()Lcom/philzhu/www/framework/Audio;

    move-result-object v5

    const-string v6, "music.ogg"

    invoke-interface {v5, v6}, Lcom/philzhu/www/framework/Audio;->newSound(Ljava/lang/String;)Lcom/philzhu/www/framework/Sound;

    move-result-object v5

    iput-object v5, p0, Lcom/philzhu/www/framework/TestScreen;->sound:Lcom/philzhu/www/framework/Sound;

    .line 35
    :try_start_0
    new-instance v1, Ljava/io/BufferedReader;

    new-instance v5, Ljava/io/InputStreamReader;

    invoke-interface {p1}, Lcom/philzhu/www/framework/Game;->getFileIO()Lcom/philzhu/www/framework/FileIO;

    move-result-object v6

    const-string v7, "test.txt"

    invoke-interface {v6, v7}, Lcom/philzhu/www/framework/FileIO;->readAsset(Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v6

    invoke-direct {v5, v6}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V

    invoke-direct {v1, v5}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V

    .line 36
    .local v1, in:Ljava/io/BufferedReader;
    invoke-virtual {v1}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v3

    .line 37
    .local v3, text:Ljava/lang/String;
    invoke-virtual {v1}, Ljava/io/BufferedReader;->close()V

    .line 39
    new-instance v2, Ljava/io/BufferedWriter;

    new-instance v5, Ljava/io/OutputStreamWriter;

    invoke-interface {p1}, Lcom/philzhu/www/framework/Game;->getFileIO()Lcom/philzhu/www/framework/FileIO;

    move-result-object v6

    const-string v7, "test.txt"

    invoke-interface {v6, v7}, Lcom/philzhu/www/framework/FileIO;->writeFile(Ljava/lang/String;)Ljava/io/OutputStream;

    move-result-object v6

    invoke-direct {v5, v6}, Ljava/io/OutputStreamWriter;-><init>(Ljava/io/OutputStream;)V

    invoke-direct {v2, v5}, Ljava/io/BufferedWriter;-><init>(Ljava/io/Writer;)V

    .line 40
    .local v2, out:Ljava/io/BufferedWriter;
    const-string v5, "This is a freaking test"

    invoke-virtual {v2, v5}, Ljava/io/BufferedWriter;->write(Ljava/lang/String;)V

    .line 41
    invoke-virtual {v2}, Ljava/io/BufferedWriter;->close()V

    .line 43
    new-instance v1, Ljava/io/BufferedReader;

    .end local v1           #in:Ljava/io/BufferedReader;
    new-instance v5, Ljava/io/InputStreamReader;

    invoke-interface {p1}, Lcom/philzhu/www/framework/Game;->getFileIO()Lcom/philzhu/www/framework/FileIO;

    move-result-object v6

    const-string v7, "test.txt"

    invoke-interface {v6, v7}, Lcom/philzhu/www/framework/FileIO;->readFile(Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v6

    invoke-direct {v5, v6}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V

    invoke-direct {v1, v5}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V

    .line 44
    .restart local v1       #in:Ljava/io/BufferedReader;
    invoke-virtual {v1}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v4

    .line 45
    .local v4, text2:Ljava/lang/String;
    invoke-virtual {v1}, Ljava/io/BufferedReader;->close()V

    .line 47
    const-string v5, "MrNom"

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-static {v3}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v7

    invoke-direct {v6, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v7, ", "

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 51
    .end local v1           #in:Ljava/io/BufferedReader;
    .end local v2           #out:Ljava/io/BufferedWriter;
    .end local v3           #text:Ljava/lang/String;
    .end local v4           #text2:Ljava/lang/String;
    :goto_0
    return-void

    .line 48
    :catch_0
    move-exception v5

    move-object v0, v5

    .line 49
    .local v0, ex:Ljava/lang/Exception;
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_0
.end method


# virtual methods
.method public dispose()V
    .locals 2

    .prologue
    .line 109
    const-string v0, "MrNom"

    const-string v1, "dispose"

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 110
    iget-object v0, p0, Lcom/philzhu/www/framework/TestScreen;->music:Lcom/philzhu/www/framework/Music;

    invoke-interface {v0}, Lcom/philzhu/www/framework/Music;->dispose()V

    .line 111
    return-void
.end method

.method public pause()V
    .locals 2

    .prologue
    .line 99
    const-string v0, "MrNom"

    const-string v1, "pause"

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 100
    return-void
.end method

.method public present(F)V
    .locals 13
    .parameter "deltaTime"

    .prologue
    .line 59
    iget-object v1, p0, Lcom/philzhu/www/framework/TestScreen;->game:Lcom/philzhu/www/framework/Game;

    invoke-interface {v1}, Lcom/philzhu/www/framework/Game;->getGraphics()Lcom/philzhu/www/framework/Graphics;

    move-result-object v0

    .line 60
    .local v0, g:Lcom/philzhu/www/framework/Graphics;
    iget-object v1, p0, Lcom/philzhu/www/framework/TestScreen;->game:Lcom/philzhu/www/framework/Game;

    invoke-interface {v1}, Lcom/philzhu/www/framework/Game;->getInput()Lcom/philzhu/www/framework/Input;

    move-result-object v9

    .line 61
    .local v9, inp:Lcom/philzhu/www/framework/Input;
    const/high16 v1, -0x1

    invoke-interface {v0, v1}, Lcom/philzhu/www/framework/Graphics;->clear(I)V

    .line 62
    const/4 v1, 0x0

    const/4 v2, 0x0

    const/16 v3, 0x140

    const/16 v4, 0x1e0

    const v5, -0xffff01

    invoke-interface/range {v0 .. v5}, Lcom/philzhu/www/framework/Graphics;->drawLine(IIIII)V

    .line 63
    const/16 v1, 0x14

    const/16 v2, 0x14

    const/16 v3, 0x64

    const/16 v4, 0x64

    const v5, -0xff0100

    invoke-interface/range {v0 .. v5}, Lcom/philzhu/www/framework/Graphics;->drawRect(IIIII)V

    .line 64
    iget-object v1, p0, Lcom/philzhu/www/framework/TestScreen;->bob:Lcom/philzhu/www/framework/Pixmap;

    const/16 v2, 0x64

    const/16 v3, 0x64

    invoke-interface {v0, v1, v2, v3}, Lcom/philzhu/www/framework/Graphics;->drawPixmap(Lcom/philzhu/www/framework/Pixmap;II)V

    .line 65
    iget-object v1, p0, Lcom/philzhu/www/framework/TestScreen;->bobAlpha:Lcom/philzhu/www/framework/Pixmap;

    const/16 v2, 0x64

    const/16 v3, 0xc8

    invoke-interface {v0, v1, v2, v3}, Lcom/philzhu/www/framework/Graphics;->drawPixmap(Lcom/philzhu/www/framework/Pixmap;II)V

    .line 66
    iget-object v1, p0, Lcom/philzhu/www/framework/TestScreen;->bob:Lcom/philzhu/www/framework/Pixmap;

    const/16 v2, 0xc8

    const/16 v3, 0xc8

    const/4 v4, 0x0

    const/4 v5, 0x0

    const/16 v6, 0x40

    const/16 v7, 0x40

    invoke-interface/range {v0 .. v7}, Lcom/philzhu/www/framework/Graphics;->drawPixmap(Lcom/philzhu/www/framework/Pixmap;IIIIII)V

    .line 67
    const/4 v8, 0x0

    .local v8, i:I
    :goto_0
    const/4 v1, 0x2

    if-lt v8, v1, :cond_1

    .line 73
    iget-object v1, p0, Lcom/philzhu/www/framework/TestScreen;->bob:Lcom/philzhu/www/framework/Pixmap;

    invoke-interface {v9}, Lcom/philzhu/www/framework/Input;->getAccelX()F

    move-result v2

    const/high16 v3, 0x4120

    mul-float/2addr v2, v3

    float-to-int v2, v2

    add-int/lit16 v2, v2, 0xa0

    const/16 v3, 0x10

    sub-int/2addr v2, v3

    invoke-interface {v9}, Lcom/philzhu/www/framework/Input;->getAccelY()F

    move-result v3

    const/high16 v4, 0x4120

    mul-float/2addr v3, v4

    float-to-int v3, v3

    add-int/lit16 v3, v3, 0xf0

    const/16 v4, 0x10

    sub-int/2addr v3, v4

    const/4 v4, 0x0

    const/4 v5, 0x0

    const/16 v6, 0x20

    const/16 v7, 0x20

    invoke-interface/range {v0 .. v7}, Lcom/philzhu/www/framework/Graphics;->drawPixmap(Lcom/philzhu/www/framework/Pixmap;IIIIII)V

    .line 75
    invoke-interface {v9}, Lcom/philzhu/www/framework/Input;->getKeyEvents()Ljava/util/List;

    move-result-object v10

    .line 76
    .local v10, keyEvents:Ljava/util/List;,"Ljava/util/List<Lcom/philzhu/www/framework/Input$KeyEvent;>;"
    invoke-interface {v10}, Ljava/util/List;->size()I

    move-result v11

    .line 77
    .local v11, len:I
    const/4 v8, 0x0

    .end local v0           #g:Lcom/philzhu/www/framework/Graphics;
    :goto_1
    if-lt v8, v11, :cond_3

    .line 81
    invoke-interface {v9}, Lcom/philzhu/www/framework/Input;->getTouchEvents()Ljava/util/List;

    move-result-object v12

    .line 82
    .local v12, touchEvents:Ljava/util/List;,"Ljava/util/List<Lcom/philzhu/www/framework/Input$TouchEvent;>;"
    invoke-interface {v12}, Ljava/util/List;->size()I

    move-result v11

    .line 83
    const/4 v8, 0x0

    :goto_2
    if-lt v8, v11, :cond_4

    .line 89
    iget v1, p0, Lcom/philzhu/www/framework/TestScreen;->frames:I

    add-int/lit8 v1, v1, 0x1

    iput v1, p0, Lcom/philzhu/www/framework/TestScreen;->frames:I

    .line 90
    invoke-static {}, Ljava/lang/System;->nanoTime()J

    move-result-wide v1

    iget-wide v3, p0, Lcom/philzhu/www/framework/TestScreen;->startTime:J

    sub-long/2addr v1, v3

    const-wide/32 v3, 0x3b9aca00

    cmp-long v1, v1, v3

    if-lez v1, :cond_0

    .line 91
    const-string v1, "MrNom"

    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "fps: "

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget v3, p0, Lcom/philzhu/www/framework/TestScreen;->frames:I

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, ", delta: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(F)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 92
    const/4 v1, 0x0

    iput v1, p0, Lcom/philzhu/www/framework/TestScreen;->frames:I

    .line 93
    invoke-static {}, Ljava/lang/System;->nanoTime()J

    move-result-wide v1

    iput-wide v1, p0, Lcom/philzhu/www/framework/TestScreen;->startTime:J

    .line 95
    :cond_0
    return-void

    .line 68
    .end local v10           #keyEvents:Ljava/util/List;,"Ljava/util/List<Lcom/philzhu/www/framework/Input$KeyEvent;>;"
    .end local v11           #len:I
    .end local v12           #touchEvents:Ljava/util/List;,"Ljava/util/List<Lcom/philzhu/www/framework/Input$TouchEvent;>;"
    .restart local v0       #g:Lcom/philzhu/www/framework/Graphics;
    :cond_1
    invoke-interface {v9, v8}, Lcom/philzhu/www/framework/Input;->isTouchDown(I)Z

    move-result v1

    if-eqz v1, :cond_2

    .line 69
    iget-object v1, p0, Lcom/philzhu/www/framework/TestScreen;->bob:Lcom/philzhu/www/framework/Pixmap;

    invoke-interface {v9, v8}, Lcom/philzhu/www/framework/Input;->getTouchX(I)I

    move-result v2

    invoke-interface {v9, v8}, Lcom/philzhu/www/framework/Input;->getTouchY(I)I

    move-result v3

    const/4 v4, 0x0

    const/4 v5, 0x0

    const/16 v6, 0x40

    const/16 v7, 0x40

    invoke-interface/range {v0 .. v7}, Lcom/philzhu/www/framework/Graphics;->drawPixmap(Lcom/philzhu/www/framework/Pixmap;IIIIII)V

    .line 67
    :cond_2
    add-int/lit8 v8, v8, 0x1

    goto/16 :goto_0

    .line 78
    .end local v0           #g:Lcom/philzhu/www/framework/Graphics;
    .restart local v10       #keyEvents:Ljava/util/List;,"Ljava/util/List<Lcom/philzhu/www/framework/Input$KeyEvent;>;"
    .restart local v11       #len:I
    :cond_3
    const-string v1, "MrNom"

    invoke-interface {v10, v8}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/philzhu/www/framework/Input$KeyEvent;

    invoke-virtual {v0}, Lcom/philzhu/www/framework/Input$KeyEvent;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 77
    add-int/lit8 v8, v8, 0x1

    goto :goto_1

    .line 84
    .restart local v12       #touchEvents:Ljava/util/List;,"Ljava/util/List<Lcom/philzhu/www/framework/Input$TouchEvent;>;"
    :cond_4
    const-string v1, "MrNom"

    invoke-interface {v12, v8}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/philzhu/www/framework/Input$TouchEvent;

    invoke-virtual {v0}, Lcom/philzhu/www/framework/Input$TouchEvent;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 85
    invoke-interface {v12, v8}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/philzhu/www/framework/Input$TouchEvent;

    iget v1, v0, Lcom/philzhu/www/framework/Input$TouchEvent;->type:I

    const/4 v2, 0x1

    if-ne v1, v2, :cond_5

    .line 86
    iget-object v1, p0, Lcom/philzhu/www/framework/TestScreen;->sound:Lcom/philzhu/www/framework/Sound;

    const/high16 v2, 0x3f80

    invoke-interface {v1, v2}, Lcom/philzhu/www/framework/Sound;->play(F)V

    .line 83
    :cond_5
    add-int/lit8 v8, v8, 0x1

    goto/16 :goto_2
.end method

.method public resume()V
    .locals 2

    .prologue
    .line 104
    const-string v0, "MrNom"

    const-string v1, "resume"

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 105
    return-void
.end method

.method public update(F)V
    .locals 0
    .parameter "deltaTime"

    .prologue
    .line 55
    return-void
.end method
